#include <iostream>
#include <queue>

using namespace std;

const int N = 100010;

int n;
int h[N],e[N],ne[N],idx;
bool st[N];

void add(int a,int b){
    idx++;
    e[idx] = b,ne[idx] = h[a],h[a] = idx;
}

void bfs(int u){
    queue<int> q;
    q.push(u);
    st[u] = true;
    while(!q.empty()){
        int t = q.front();
        q.pop();
        cout << t << " ";
        for(int i = h[t];i;i = ne[i]){
            int j = e[i];
            if(!st[j]){
                q.push(j);
                st[j] = true;
            }
        }
    }
}

int main(){
    cin >> n;
    for(int i = 1;i < n;i++){
        int a ,b; cin >> a >> b;
        add(a,b);
        add(b,a);
    }

    bfs(1);
    
}   